home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / djvga02.arc / DJDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1991-05-17  |  3KB  |  107 lines

  1. Program DJGraphicsDemo;
  2.  
  3. Uses DJVGA,Crt;
  4.  
  5. Var R1,R2,I,I1,I2:Integer;
  6.  
  7. Function KeyPressed:Boolean; Assembler;
  8. ASM
  9.    MOV AH,0BH   { check if key has been pressed? }
  10.    INT 21H      { call dos }
  11.    AND AL,AL    { if a key pending ? }
  12.    JZ  @no      { nope }
  13.    MOV AL,True  { yupe }
  14. @no:
  15. End;
  16.  
  17. Procedure WaitKey; Assembler;
  18. ASM
  19.    MOV AH,1
  20.    INT 21H
  21. End;
  22.  
  23. Begin
  24.    { set mode 320x200x16 mode, you can also use just about any other EGA/VGA
  25.      mode available }
  26.    DJ_SetVideoMode($0D);
  27.  
  28.    { Test Line Procedures }
  29.    { draw box around screen }
  30.    DJ_Line(10,10,300,10,12);
  31.    DJ_Line(300,10,300,180,12);
  32.    DJ_Line(300,180,10,180,12);
  33.    DJ_Line(10,180,10,10,12);
  34.    WaitKey;
  35.    DJ_ClrScr;
  36.  
  37.    Repeat
  38.      R1 := Random(14)+1;
  39.      R2 := Random(14)+1;
  40.      For I1 := 1 To 200 Do
  41.      Begin
  42.          For I2 := 1 To 200 Do
  43.          Begin
  44.              DJ_DPutPixel(I1,I2,R1);
  45.              DJ_DPutPixel(I2,I1,R2);
  46.          End;
  47.      End;
  48.    Until KeyPressed;
  49.    { clear the keypress }
  50.    WaitKey;
  51.    DJ_ClrScr;
  52.  
  53.    For I := 1 To 100 Do DJ_DPutPixel(Random(319)+1,Random(199)+1,Random(14)+1);
  54.  
  55.    For I1 := 1 To 320 Do
  56.    Begin
  57.        For I2 := 1 To 200 Do
  58.        Begin
  59.            If DJ_DGetPixel(I1,I2) > 0 Then DJ_DPutPixel(I1,I2,0);  { change to black }
  60.        End;
  61.    End;
  62.  
  63.    WaitKey;
  64.  
  65.    { Filled_Rectangle Demonstration }
  66.    DJ_Filled_Rectangle(0,0,320,200,15);  { Fill Screen with white }
  67.    WaitKey;
  68.  
  69.    { Fade Demonstration }
  70.    DJ_Filled_Rectangle(0,0,320,200,0);   { Fill Screen with black }
  71.    DJ_Fade(MaxPix+500,11);               { Fade into a cyan color }
  72.    WaitKey;
  73.  
  74.    { Lines from screen center Demonstration }
  75.    DJ_Filled_Rectangle(0,0,320,200,0);   { Fill Screen with black }
  76.    Repeat
  77.        DJ_Lines_From_Center(Random(15)+1,95);          { Draw a bunch of lines }
  78.        Delay(140);
  79.        DJ_Lines_From_Center(Random(15)+1,100);          { Draw a bunch of lines }
  80.        Delay(140);
  81.        DJ_Lines_From_Center(Random(15)+1,105);          { Draw a bunch of lines }
  82.        Delay(140);
  83.        DJ_Lines_From_Center(Random(15)+1,110);          { Draw a bunch of lines }
  84.        Delay(140);
  85.        DJ_Lines_From_Center(Random(15)+1,115);          { Draw a bunch of lines }
  86.        Delay(140);    { Need delay, screen drawing way too fast to see! }
  87.        DJ_Filled_Rectangle(0,0,320,200,0);   { Clear Screen }
  88.    Until KeyPressed;
  89.    WaitKey;
  90.  
  91.    { Ellipse/Circle Demonstration }
  92.    DJ_Ellipse(110,100,60,50,15);         { Draw Bunch of Neat Circles }
  93.    DJ_Ellipse(120,100,65,55,12);
  94.    DJ_Ellipse(130,100,70,60,11);
  95.    DJ_Ellipse(140,100,75,65,10);
  96.    DJ_Ellipse(115,100,80,70,9);
  97.    DJ_Ellipse(125,100,85,75,8);
  98.    DJ_Ellipse(135,100,90,80,7);
  99.    DJ_Ellipse(140,100,95,85,13);
  100.    DJ_Ellipse(145,100,100,90,14);
  101.    WaitKey;
  102.  
  103.    { return to text mode }
  104.    DJ_SetVideoMode($03);
  105. End.
  106.  
  107.